home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 2000 November: Tool Chest / Dev.CD Nov 00 TC Disk 1.toast / Sample Code / Archive / Graphics / QuickDraw GX / GX->PostScript Sample / GXToPostScript / Imaging Engine / Private.h < prev    next >
Encoding:
C/C++ Source or Header  |  2000-09-28  |  25.4 KB  |  788 lines  |  [TEXT/MPS ]

  1. /*
  2.      File:        Private.h
  3.  
  4.      Contains:    QuickDraw GX to PostScript conversion code.
  5.                          contains the includes for the
  6.                         GX to PostScript imaging engine
  7.  
  8.      Version:    Technology:    Quickdraw GX 1.1.x
  9.       
  10.      Copyright:    © 1990-1997 by Apple Computer, Inc., all rights reserved.
  11. */
  12.  
  13. #ifndef __PRIVATE__
  14. #define __PRIVATE__
  15.  
  16. #include "GXToPSBuildConfig.h"
  17.  
  18. #if DEBUGLEVEL > 0
  19.     #define TIMEIE
  20. #endif
  21.  
  22. //#include "GXErrors.h"
  23. #include <CMApplication.h>
  24. #include <GXGraphics.h>
  25. #include "RDUtil.h"
  26. #include "PublicPostScriptIE.h"
  27. #include "FontHandler.h"
  28. #include "GXExceptions.h"
  29.  
  30.  
  31. #define kUnderlineCheckMask (gxUnderlineAdvanceLayer | gxSkipWhiteSpaceLayer | gxUnderlineIntervalLayer | gxUnderlineContinuationLayer)
  32.  
  33. /** subtract this value from result of GetTagStructure because of gx graphics bug in d24 **/
  34.  
  35.  
  36.     #define tagStructureBugOffset            0
  37.  
  38.  
  39. /****** Define fill key Macros for RDResPrintf %s parameter *********/
  40. #define kEvenOddFillKey                        "\pEo"
  41. #define kWindingFillKey                        "\pW"
  42. #define kFrameFillKey                            "\pFr"
  43. #define kInverseFillKey                        "\pIn"
  44. #define kNoFillKey                                "\pNo"
  45.  
  46.  
  47. /*********** Define some PostScript constants *************/
  48.  
  49. #define eMiterJoin    0
  50. #define eRoundJoin    1
  51. #define eBevelJoin    2
  52.  
  53. #define kInitLineWidth        ff(1)
  54. #define kInitMiterLim            ff(1)
  55. #define kInitFlat                    ff(1)
  56.  
  57.  
  58. /***** Glyph Positioning Bias codes ********/
  59. typedef enum {
  60.     
  61.     eAllVertical = 1,                                // If all of the x positions are the same
  62.     eAllHorizontal = 2,                            // If all of the y positions are the same
  63.     eMixed = 3,                                            // If some are different.
  64.     eAllEqual = 4                                        // This one is only useful for deltas, not positions.
  65.     
  66. } TGlyphPosBias;
  67.  
  68.  
  69. /*** flags for current imaging engine state ***/
  70.  
  71. typedef enum {
  72.  
  73.     eSimpleStyle = 0x01L,                    // Is the shape renderable by stroke, fill, rather than QD2Fill?
  74.     eTmodeOutOfDate = 0x02L,            // Is transfer mode in graphics state invalid for some reason?
  75.     eStyleOutOfDate = 0x04L,            // Is style in graphics state invalid for some reason?
  76.     eTransformOutOfDate = 0x08L,    // Is transform in graphics state invalid for some reason?
  77.     eFontOutOfDate = 0x10L,                // Is font in graphics state invalid for some reason?
  78.     eHasDash = 0x20L,                            // Did the last style have a dash?    
  79.     eHasPattern = 0x40L,                    // Did the last style have a pattern?
  80.     eColorOutOfDate = 0x80L,            // Is the color in the graphics state out of date?
  81.     eColorSetOutOfDate = 0x100L,    // Is the color set in the graphics state out of date?
  82.     ePSContinueNext = 0x200L,            // In the midst of postscript broken up over multiple shapes.
  83.  
  84.     eInkOutOfDate = (eTmodeOutOfDate | eColorOutOfDate),
  85.     
  86.     eInitializeGstate = (eColorSetOutOfDate | eInkOutOfDate | eStyleOutOfDate | eTransformOutOfDate | eFontOutOfDate)
  87.  
  88. } TIEStateFlags;
  89.  
  90. /*** Flags for PSPrimitiveShape ***/
  91.  
  92. typedef enum {
  93.  
  94.     eApplyDash = 0x01L,
  95.     eApplyPattern = 0x02L,
  96.     eApplyJoin = 0x04L,
  97.     eApplyCaps = 0x08L,
  98.     eApplyPen = 0x10L,
  99.     
  100.     eApplyFrameStyle = (eApplyDash | eApplyJoin | eApplyCaps | eApplyPen),
  101.     
  102.     eApplyAll = (eApplyFrameStyle | eApplyPattern)
  103.  
  104. } TIEPrimitiveFlag;
  105. typedef unsigned long TIEPrimitiveFlags;
  106.  
  107. /******** Some handy macros ****************/
  108.  
  109. /****************************
  110.     NEXTBIT, PREVBIT:
  111.     Used for tranversal of bit arrays.
  112.     
  113.     theBit:                Boolean, true if bit was set.
  114.     theLong:            pointer to the current longword in bit array.
  115.     theMask:            current long word mask.  Initialize to 0x80000000 for first bit in array.
  116.     
  117.     NEXTBIT Checks current bit and then advances mask
  118.     PREVBIT rolls back mask and then checks bit.
  119.     
  120. *****************************/
  121. #define NEXTBIT(theBit, theLong, theMask)  {\
  122.                                                                                             theBit = ((*theLong & theMask) != 0); \
  123.                                                                                              if (!(theMask>>=1)) \
  124.                                                                                                 {theMask = 0x80000000; ++theLong;} \
  125.                                                                                         }
  126.  
  127. #define PREVBIT(theBit, theLong, theMask) {\
  128.                                                                                         if (!(theMask<<1)) \
  129.                                                                                             {theMask = 0x00000001; --theLong;} \
  130.                                                                                         theBit = ((*theLong & theMask) != 0); \
  131.                                                                                     }
  132.  
  133.  
  134.  
  135.  
  136. /****************************************
  137.     Macro to interpolate between two points.
  138.     
  139.     p:            The point that will get the result.
  140.     p1:            The first point to interpolate between
  141.     p2:            The second point to interpolate between
  142.     
  143. *****************************************/
  144.     
  145.     // Code to average two fixed point numbers.  Taken from gx graphics file "paths.h"  Does math in 33 bits.
  146.  
  147.     #ifdef asm68000
  148.         #pragma parameter __D0 Average(__D0, __D1)
  149.         long Average(long x, long y) = { 0xD081, 0x6804, 0xE290, 0x6002, 0xE280 };
  150.         /* add.l d1,d0; bvc.s 4(pc); roxr.l #1,d0; bra.s 2(pc); asr.l #1,d0 */
  151.     #else
  152.         static long Average(register long x, register long y) { return (x >> 1) + (y >> 1) + ((x & y) & 1); }
  153.     #endif
  154.  
  155.  
  156. #define INTERPPOINT(p, p1, p2) {\
  157.                                                                     (p).x = Average( (p1).x, (p2).x) ; \
  158.                                                                     (p).y = Average( (p1).y, (p2).y) ; \
  159.                                                              }
  160.                                                                 
  161.  
  162.  
  163.  
  164. /*********************************************
  165.  
  166.     Macro to convert a color component which is an
  167.     unsigned short into a fixed point value between 
  168.     zero and one.
  169.     
  170. ***********************************************/
  171.  
  172. /* normal color components: 65535 = 1.0 */
  173. #define COMPONENTtoFIXED(component)    FixedDivide( (Fixed)(component), (Fixed)0x0000FFFF )
  174. /* XYZ color components: 32768 = 1.0 */
  175. #define XYZCOMPONENTtoFIXED(component) ( 2 * COMPONENTtoFIXED(component) )
  176.  
  177.  
  178. /** Macro to test a shape for picture type **/
  179. #define    TestShapeTypePict( sh ) (GXGetShapeType(sh) == gxPictureType)
  180.  
  181.  
  182. // data structures
  183.  
  184. /*** Flags for nested graphics states ***/
  185. enum {
  186.  
  187.     eNoGstateFlags =            0x00000000,
  188.     eGstateDidSave =             0x00000001                // set if a SAVE (font Handler etc…) was done at this level.
  189.  
  190. };
  191. typedef long TgstateFlags;
  192.  
  193.  
  194.  
  195. /***************************
  196.  
  197.     Data structure to represent the
  198.     nestable graphics state on the printer.
  199.     These things will not be preserved across
  200.     grestores.
  201.     
  202. ****************************/
  203. typedef struct {
  204.     
  205.     gxColorProfile    currProfile;        // This is only used in Level-2 color
  206.     gxColorSpace        currSpace;            // This is only used in Level-2 color
  207.     long /*bool*/        level2DevSpace;    // This is only used in Level-2 color - whether or not we are using a device space rather than matching.
  208.     gxColor                    currColor;            // Color will be part of the nest because it is to hard to make persistant across grestores.
  209.     gxInk                        theInk;                    // The ink for this level.
  210.     gxTag                        halftoneTag;        // halftone tag from this ink.
  211.     gxTransform            theTransform;        // the gx graphics transform for this level.
  212.     long                        pointsAvail;        // The number of points left after this level's clip.
  213.     TgstateFlags        flags;                    // flags for this level.
  214.     
  215. } TGstate;
  216.  
  217.  
  218.  
  219.  
  220. /*************************************
  221.     Data structure for Imaging Engine
  222.     Global data.
  223.     
  224.         A note about the pRDParams field.
  225.         Every IE interface routine must
  226.         allocate an RD parameter block on the
  227.         stack and assign this field to be
  228.         its address.  Anybody down the call
  229.         chain may depend on this being there.
  230.         
  231.         Doing it this way avoids having to have
  232.         the record in the context handle, forcing
  233.         us to lock the handle whenever we call
  234.         an RDUtility routine.
  235.         
  236.         A note on the initializeGstate bit fields:
  237.             This is set to true at the beginning
  238.             of the PostScriptInitGraphics routine.
  239.             drones and primitives that modify the graphics state
  240.             look at this to see if they should output the primitive (color, font, etc…)
  241.             whether or not it matches the one in the current graphics 
  242.             state cache.  PostScriptInitGraphis resets this
  243.             to false when it is done.
  244.             
  245.             The effect of it accidentally being true is not fatal,
  246.             it just causes the gstate value to be output whether or
  247.             not it was the same as the current one.
  248.     
  249. *************************************/
  250.  
  251. typedef struct    {
  252.  
  253.     CGXtoPostScriptDevice                *psDevice;                // Device for I/O
  254.  
  255.     gxPostScriptImageDataRec        params;                        // Imaging parameters from EnterPS
  256.     TCompatibilityFlags                    compatFlags;            // Old app Compatability flags.
  257.     
  258.     #ifdef usePerfLib
  259.         TP2PerfGlobals                            perfGlobals;            //    performance library globals.
  260.     #endif
  261.     
  262.     gxMapping                                        deviceMapping;        // Mapping from userspace to device coordinates on printer.
  263.     
  264.     TFontHandlerContext                    fhContext;                // Font Handler context.
  265.         
  266.     TRDMapHdl                rdMap;                                                // Resource Dump Utilities map.
  267.     TRDParams*            pRDParams;                                        // Pointer to an RD parameter block.
  268.     
  269.     
  270.     gxColorSet                graySet;                                        // Color set for 8-bit gray image operator.
  271.     gxColorProfile        defaultProfileCopy;                    // A copy of the default we can own.
  272.  
  273.     /*****
  274.         Stuff for timing in debug builds.
  275.     ******/
  276.     #ifdef TIMEIE
  277.         long    pageTime;
  278.         long    shapeTime;
  279.         long    shapeCount;
  280.     #endif
  281.     
  282.     /*****
  283.             Actual work spaces are allocated at end of this block for more efficient referencing
  284.             of this data structure.  Additionally, the maximum number of blocks will be max-gsaves.
  285.     *****/
  286.     long                        offsetToWorkspace;        // amount to add to address of globals to get to workspace array
  287.     short                        workSpaceIndex;                // Current work space index.
  288.     Handle                    hWorkSpace;                        // Current work space handle;
  289.  
  290.     long                        ieStateFlags;                    // Current state of Imaging.  (See enumeration above)
  291.     
  292.     /****
  293.         Save original shape in case the Imaging Engine (or font handleur) has to modify
  294.         them for translation to PostScript
  295.     ****/
  296.     gxShape                    saveShape;
  297.     
  298.     /*** Persistant Graphics State Fields ***/
  299.     
  300.     Fixed                        lineWidth;
  301.     short                        lineCap;
  302.     short                        lineJoin;
  303.     Fixed                        curveFlat;
  304.     Fixed                        miterLimit;
  305.     short                        orMode;                                //    Bitmap or transfer mode.
  306.     gxColorSet            theColorSet;                    //    Current color set.
  307.     long                        psFrameValue;                    //    Value for SetFrame proc (0=center, 1 = inside, -1 = outside)
  308.     Boolean                    currRightIsOut;
  309.     gxStyle                    theStyle;
  310.     
  311.                     // Information concerning current font in Persistant graphics state.
  312.     
  313.     fhFont                    theFont;                            // Font Handler font reference (wrapper for GX font reference that resolves variations).
  314.     long                        fontChild;                        // Font Handler child font index for font handler multiply encoded fonts.
  315.     Fixed                        fontSize;                            // Point size of current9tate.
  316.     gxStyle                    textStyle;                        // Current text style for comparing text-faces.
  317.     gxPoint                    fontTangent;                    // Current tangent for text on a path (or mixed vertical/horizontal)
  318.     
  319.     
  320.     /****** 
  321.         Nested graphics state fields:
  322.         pBaseGstate will point to gStateArray[0]
  323.         gStateNest will point to gStateArray[1], hench gStateNest[0] is
  324.         gStateArray[1] and gStateNest[-1] will be gStateArray[0] which is
  325.         the base graphics state.  This allows
  326.         gStateNest's indeces be in phase with the transform list indecs that
  327.         come into PostScriptDrawShape
  328.     *******/
  329.  
  330.     short                        gStateDepth;                // Current depth of graphics state stack.
  331.     TGstate*                baseGstate;                    // Pointer to the base graphics state (will point to gSTateArray[0]);
  332.     TGstate*                gStateNest;                    // Pointer to the nested graphics states.  (will piont to gStateArray[1]);
  333.     TGstate                    gStateArray[1];            // Stack o'graphics states, one for each transform level plus the base level.
  334.     
  335.     /** Reentrant workspace handles **/
  336.  
  337.     Handle                    hWorkSpaces[1];            // Array of workspace handles.
  338.     
  339.     
  340. } TIEGlobalsRec, *TIEGlobalsPtr, **TIEGlobalsHdl;    
  341.  
  342.  
  343. typedef enum {
  344.     
  345.     eNoGeomOptions =    0X00L,                    // Implies direct output for rendering
  346.     eMakeProcedure =     0X01L,                    // For dashes, patterns, aux shapes, clips in transform dicts.
  347.     eBreakContours =     0X02L,                    // For break-dash
  348.     eClipGeometry =     0X04L                        // This is set when the geometry is for a clip.
  349.     
  350. } GeometryOptions;
  351.  
  352. typedef long TgeometryOptions;
  353.  
  354.  
  355.  
  356.  
  357. typedef struct {
  358.  
  359.     long                        nChars;
  360.     long                        byteCount;
  361.     long                        nStyles;
  362.     unsigned char        *glyphs;
  363.     char                        *text8;
  364.     gxPoint                    *positions;
  365.     gxPoint                    *tangents;
  366.     unsigned long        *advanceBits;
  367.     gxStyle                    *styles;
  368.     short                        *runs;
  369.     unsigned long        *fhUserData;                    // Font Handler user data.
  370.     gxPoint                    *absPositions;                // Absolute positions for all glyphs, needed in level-2.
  371.     long                        fhUserDataSize;                // How big is font handleur data.    
  372.     
  373.     unsigned long        advMask;                            // Mask for traversing advance bits.
  374.     unsigned long*    advLong;                            // Pointer into current long full o'advance bits.
  375.     
  376.     unsigned long        twoByteMask;                    // mask for traversing 1-or-2 byte bits.
  377.     unsigned long*    twoByteLong;                    // Pointer into current long full o'1-or-2 byte bits.
  378.     
  379.     unsigned char*    currByte;                            // Pointer to byte we are currently at in shape.
  380.  
  381. } TGlyphDataRec;
  382.  
  383.  
  384. /**** Internal Procedures *******/
  385.  
  386.  
  387. /**********************/
  388. /* Linked-In Routines */
  389. /**********************/
  390.  
  391. OSErr    PSIEBufferData(TIEGlobalsHdl hIEGlobals, unsigned char *data, long length, long flags);
  392.  
  393.  
  394. long         GetPSLineJoin(gxJoinRecord* theJoin);
  395. Fixed     SkiaMiterToPS(Fixed miterValue, Fixed lineWidth);
  396. void        ResetShapeStyle(gxShape);
  397. void        ResetShapeTransform(gxShape);
  398. OSErr     PSPrimitiveShape(gxShape theShape, TIEPrimitiveFlags flags);
  399. OSErr     PSTextToPaths(gxShape theShape);
  400. void         ConcatTransform(gxTransform source, gxTransform operand);
  401. OSErr        MapWholeShape(gxShape theShape, gxMapping *theMapping);
  402. Boolean    TestInkModeCopy( gxInk shInk );
  403. short        TestInkModeOr( gxInk shInk );
  404. Boolean TestMappingEqual( gxMapping *oneMapping, gxMapping *twoMapping );
  405. Boolean TestMappingPerspective( gxMapping *theMapping);
  406. Boolean    TestMappingIdentity( gxMapping *theMapping);
  407. OSErr     PSReleaseWorkSpace(TIEGlobalsHdl hGlobals);
  408. OSErr        PSSetWorkSpaceSize(TIEGlobalsHdl hGlobals, long newSize);
  409. void        DisposeGstateItems(TGstate *pGstate);
  410.  
  411. gxColorSet CreateGrayColorSet(void);
  412.  
  413.  
  414. long GetColorProfileSize(gxColorProfile theProfile, long *profileVersion);
  415.  
  416. OSErr DoBeginProcedure(TIEGlobalsHdl hGlobals);
  417. OSErr DoEndProcedure(TIEGlobalsHdl hGlobals);
  418. OSErr    DoBeginArray(TIEGlobalsHdl hGlobals);
  419. OSErr DoEndArray(TIEGlobalsHdl hGlobals);
  420. OSErr DoFillKey(TRDParams* pRDParams, gxShapeFill theFill);
  421. OSErr DoNull(TRDParams *rdParams);
  422. OSErr    BeginProcSetDict(TRDParams *rdParams);
  423. OSErr    EndProcSetDict(TRDParams *rdParams);
  424. OSErr    OutputTag(TIEGlobalsHdl hGlobals, gxTag theTag);
  425.  
  426. Boolean TestStyleDash(gxStyle theStyle);
  427. Boolean TestStylePattern(gxStyle theStyle);
  428.  
  429. Boolean TestMiterMatters(gxShape theShape, gxJoinRecord *theJoin, Fixed pen);
  430. Boolean TestNonCenterShapeCanBeInset(gxShape theShape, gxStyle theStyle);
  431.  
  432. OSErr AnalyzeTextFace(TIEGlobalsHdl hIEGlobals, gxShape theShape, Boolean *hasUnderline, Boolean *notPostscriptable);
  433. Boolean TestDashPostScriptable(gxShape theShape, gxDashRecord *theDash, gxStyleAttribute theAttr);
  434.  
  435.  
  436. Boolean    PSEqualColorSet(gxColorSet set1, gxColorSet set2);
  437. Boolean PSEqualInk(gxInk ink1, gxInk ink2);
  438. Boolean PSEqualTransform(gxTransform transform1, gxTransform transform2);
  439. Boolean PSEqualStyle(gxStyle style1, gxStyle style2);
  440. void        PSDisposeColorSet(gxColorSet theSet);
  441.  
  442. #define    gxQuickDrawPictType    100
  443. gxShapeType    QGXGetShapeType(gxShape source);
  444.  
  445.  
  446. /****
  447.     Tag identifier for shapes that have been pre-rasterized, 
  448.     used for 2-byte text when font downloading is too slow.
  449.     Tag contents is a mapping to be used as the additional mapping
  450.     for the ImageMask operation.  Tag also implies or-mode - handled in PS code.
  451. ****/
  452. #define rasterizedShapeTag    0x70737273        /* 'psrs' */
  453. OSErr    PSRasterizeShape(TIEGlobalsHdl hIEGlobals, gxShape theShape, gxTransform *parents, long nTransforms);
  454.  
  455.  
  456.  
  457.  
  458. void MakePatternPostScriptable(gxPatternRecord *thePattern, gxStyleAttribute theAttr);
  459. void SwapShapeAndBitmapClip(gxShape theShape);
  460.  
  461. OSErr DupShapeIfNecessary(gxShape theShape, gxShape* newShape);
  462.  
  463. long GetPSFrameValue(gxStyleAttribute theAttributes);
  464.  
  465.  
  466. OSErr TransformDrone(TIEGlobalsHdl hIEGlobals, gxTransform theTransform);
  467.  
  468.  
  469. /** Data Structures to Dictionaries **/
  470.  
  471. OSErr MakeShapeDict(TIEGlobalsHdl hIEGlobals, gxShape theShape, TgeometryOptions theOptions);
  472.  
  473. OSErr    MakeStyleDict(TIEGlobalsHdl hIEGlobals, gxStyle theStyle);
  474.  
  475. OSErr MakeTransformDict(TIEGlobalsHdl hIEGlobals, gxTransform theTransform);
  476.  
  477.  
  478.  
  479.  
  480. void DoNothingNoticeFunction( gxGraphicsNotice theNotice );
  481.  
  482.  
  483. /**** Web 'o Doom Procedures *****/
  484.  
  485. /* Primary Drones */
  486.  
  487. OSErr ValidateFillShape(TIEGlobalsHdl hIEGlobals, gxShape *theShape);
  488.  
  489. OSErr ShapeDrone(TIEGlobalsHdl hIEGlobals, gxShape theShape, gxTransform *parents, long depth);
  490.  
  491. OSErr ResolveComplexTransform(TIEGlobalsHdl hIEGlobals, gxTransform *parents, long *depth,
  492.                                                                 gxShape *pShape);
  493.  
  494.  
  495.  
  496.  
  497. /** Low level glyph handling routines **/
  498. OSErr ProcessGlyphGroupPosL1(short nGlyphs, gxPoint *positions, char *text8, long byteCount,
  499.                                                             TRDParams *rdParams, TGlyphPosBias theBias, long addToIndex);
  500.                                 
  501. OSErr ProcessGlyphGroupPosL2(TIEGlobalsHdl hIEGlobals, short nGlyphs, gxPoint *positions, char *text8, long byteCount,
  502.                                                             TRDParams *rdParams, TGlyphPosBias theBias, long addToIndex, gxPoint *nextDelta);
  503.  
  504.  
  505. /** Really primitive primitives **/
  506.  
  507. OSErr    DoMoveto(TRDParams *rdParams, gxPoint *thePoint);
  508.  
  509. OSErr DoClosepath(TRDParams *rdParams);
  510.  
  511. OSErr    DoPoint(TRDParams *rdParams, gxPoint *thePoint);
  512.  
  513. OSErr    DoRmoveto(TRDParams *rdParams, gxPoint *thePoint);
  514.  
  515.  
  516. /*** Graphics State Primitive Routines ******/
  517.  
  518.  
  519. OSErr MappingPrimitive(TIEGlobalsHdl, gxMapping *theMapping);
  520.  
  521. OSErr RGBColorPrimitive(TIEGlobalsHdl hIEGlobals, gxRGBColor *theRGB);
  522.  
  523. OSErr GrayColorPrimitive(TIEGlobalsHdl hIEGlobals, unsigned short theGray);
  524.  
  525. OSErr CMYKColorPrimitive(TIEGlobalsHdl hIEGlobals, gxCMYKColor *theCMYK);
  526.  
  527. OSErr    Level2ColorPrimitive(TIEGlobalsHdl hIEGlobals, gxColor *theColor);
  528.  
  529. OSErr ColorSetPrimitive(TIEGlobalsHdl hIEGlobals, gxColorSet theSet, gxColorProfile theProfile );
  530.  
  531. OSErr FrameStylePrimitive(TIEGlobalsHdl hIEGlobals, gxStyle theStyle);
  532.  
  533. OSErr MiscStylePrimitive(TIEGlobalsHdl hIEGlobals, gxStyle theStyle);
  534.  
  535. OSErr FixGraphicsState(TIEGlobalsHdl hGlobals, Boolean didRestore, Boolean didSave);
  536.  
  537. /**** ColorSync PostScript data management routines ******/
  538.  
  539. pascal OSErr    ICCProfileStreamProc(long command, long *size, void *data, TIEGlobalsHdl hIEGlobals);
  540.  
  541. OSErr MakeCRDAvailable(TIEGlobalsHdl hIEGlobals, CMProfileRef theICCProf);
  542.  
  543.  
  544. // Segmented Routines also called internally from within the same segment...
  545.  
  546.     
  547. #if GENERATING68K
  548.     OSErr _DoGsave(TIEGlobalsHdl hIEGlobals, Boolean internalOnly);
  549.     OSErr    _GeometryDrone(TIEGlobalsHdl hIEGlobals, gxShape theShape, TgeometryOptions geomOptions, gxTransform *parents, long depth);
  550.     OSErr    _DoGrestore(TIEGlobalsHdl hIEGlobals, Boolean internalOnly);
  551.     OSErr    _TextStylePrimitive(TIEGlobalsHdl hIEGlobals, gxStyle textStyle, gxPoint* pTangent);
  552. #endif
  553.  
  554. /**********************/
  555. /* Segment Dispatches */
  556. /**********************/
  557.  
  558.  
  559. //-----------------------------------------------------------------------------------------------
  560.  
  561. #if GENERATING68K
  562.     #define PSIEPATHLIMIT_DISPATCH(selector) = CLIENT_DISPATCH(PSIEPathLimitSEG, selector);
  563. #else
  564.  
  565.     #define PSIEPATHLIMIT_DISPATCH(selector) ;
  566.     
  567.     #define _DissectShape                        DissectShape
  568.     #define _PSCountShapePoints            PSCountShapePoints
  569.     
  570. #endif
  571.  
  572. OSErr    DissectShape(TIEGlobalsHdl hIEGlobals, gxShape *theShape)
  573.      PSIEPATHLIMIT_DISPATCH(1)
  574.  
  575. OSErr    PSCountShapePoints(gxShape theShape, long contour, long *numPoints)
  576.      PSIEPATHLIMIT_DISPATCH(2)
  577.  
  578.  
  579. //-----------------------------------------------------------------------------------------------
  580.  
  581. #if GENERATING68K
  582.     #define PSIEBITMAP_DISPATCH(selector) = CLIENT_DISPATCH(PSIEBitmapSEG, selector);
  583. #else
  584.     #define PSIEBITMAP_DISPATCH(selector) ;
  585.     
  586.     #define _BitmapPrimitive                    BitmapPrimitive
  587.     #define _IntersectShapeAndBitmap    IntersectShapeAndBitmap
  588.     
  589. #endif
  590.  
  591.  
  592. OSErr BitmapPrimitive(TIEGlobalsHdl hIEGlobals, gxShape theShape, TgeometryOptions geomOptions)
  593.      PSIEBITMAP_DISPATCH(1)
  594.  
  595. OSErr IntersectShapeAndBitmap(gxShape target, gxShape operand)
  596.      PSIEBITMAP_DISPATCH(2)
  597.  
  598.  
  599. //-----------------------------------------------------------------------------------------------
  600.  
  601. #if GENERATING68K
  602.     #define PSIEHALFTONE_DISPATCH(selector) = CLIENT_DISPATCH(PSIEHalftoneSEG, selector);
  603. #else
  604.  
  605.     #define PSIEHALFTONE_DISPATCH(selector) ;
  606.     
  607.     #define _HalftonePrimitive        HalftonePrimitive
  608.     
  609. #endif
  610.  
  611. OSErr HalftonePrimitive(TIEGlobalsHdl hIEGlobals, gxFormatHalftoneInfo *halftoneInfo)
  612.      PSIEHALFTONE_DISPATCH(1)
  613.  
  614.  
  615. //-----------------------------------------------------------------------------------------------
  616.  
  617. #if GENERATING68K
  618.     #define PSIEPRIMITIVE_DISPATCH(selector) =  CLIENT_DISPATCH(PSIEPrimitiveSEG, selector);
  619. #else
  620.  
  621.     #define PSIEPRIMITIVE_DISPATCH(selector)    ;
  622.     
  623.     #define    _CubicPrimitive                CubicPrimitive
  624.     #define _PathsPrimitive                PathsPrimitive
  625.     #define _PolygonsPrimitive        PolygonsPrimitive
  626.     #define _PointPrimitive                PointPrimitive
  627.     #define _CurvePrimitive                CurvePrimitive
  628.     #define _LinePrimitive                LinePrimitive
  629.     #define _RectanglePrimitive        RectanglePrimitive
  630.     #define _FullShapePrimitive        FullShapePrimitive
  631.     #define _EmptyShapePrimitive    EmptyShapePrimitive
  632.     
  633. #endif
  634.  
  635.  
  636. OSErr    CubicPrimitive(TIEGlobalsHdl hIEGlobals, gxShape theShape, TgeometryOptions geomOptions)
  637.      PSIEPRIMITIVE_DISPATCH(1)
  638.  
  639. OSErr PathsPrimitive(TIEGlobalsHdl hIEGlobals, gxShape theShape, TgeometryOptions geomOptions)
  640.      PSIEPRIMITIVE_DISPATCH(2)
  641.  
  642. OSErr PolygonsPrimitive(TIEGlobalsHdl hIEGlobals, gxShape theShape, TgeometryOptions geomOptions)
  643.      PSIEPRIMITIVE_DISPATCH(3)
  644.  
  645. OSErr PointPrimitive(TIEGlobalsHdl hIEGlobals, gxShape theShape, TgeometryOptions geomOptions)
  646.      PSIEPRIMITIVE_DISPATCH(4)
  647.  
  648. OSErr CurvePrimitive(TIEGlobalsHdl hIEGlobals, gxShape theShape, TgeometryOptions geomOptions)
  649.      PSIEPRIMITIVE_DISPATCH(5)
  650.  
  651. OSErr LinePrimitive(TIEGlobalsHdl hIEGlobals, gxShape theShape, TgeometryOptions geomOptions)
  652.      PSIEPRIMITIVE_DISPATCH(6)
  653.  
  654. OSErr RectanglePrimitive(TIEGlobalsHdl hIEGlobals, gxShape theShape, TgeometryOptions geomOptions)
  655.      PSIEPRIMITIVE_DISPATCH(7)
  656.  
  657. OSErr FullShapePrimitive(TIEGlobalsHdl hIEGlobals, gxShape theShape, TgeometryOptions geomOptions)
  658.      PSIEPRIMITIVE_DISPATCH(8)
  659.  
  660. OSErr    EmptyShapePrimitive(TIEGlobalsHdl hIEGlobals, gxShape theShape, TgeometryOptions geomOptions)
  661.      PSIEPRIMITIVE_DISPATCH(9)
  662.  
  663.  
  664. //-----------------------------------------------------------------------------------------------
  665.  
  666. #if GENERATING68K
  667.     #define PSIETEXT_DISPATCH(selector) = CLIENT_DISPATCH(PSIETextSEG, selector);
  668. #else
  669.  
  670.     #define PSIETEXT_DISPATCH(selector) ;
  671.     
  672.     #define _TextPrimitive                    TextPrimitive
  673.     #define _GlyphPrimitive                    GlyphPrimitive
  674.     #define _SeperateUnderlineShape    SeperateUnderlineShape
  675.     #define _TextStylePrimitive            TextStylePrimitive
  676.     
  677. #endif
  678.  
  679. OSErr TextPrimitive(TIEGlobalsHdl hIEGlobals, gxShape theShape, TgeometryOptions geomOptions)
  680.      PSIETEXT_DISPATCH(1)
  681.  
  682. OSErr GlyphPrimitive(TIEGlobalsHdl hIEGlobals, gxShape theShape, TgeometryOptions geomOptions)
  683.      PSIETEXT_DISPATCH(2)
  684.  
  685. OSErr SeperateUnderlineShape(TIEGlobalsHdl hIEGlobals, gxShape theShape)
  686.      PSIETEXT_DISPATCH(3)
  687.  
  688. OSErr    TextStylePrimitive(TIEGlobalsHdl hIEGlobals, gxStyle textStyle, gxPoint* pTangent)
  689.      PSIETEXT_DISPATCH(4)
  690.  
  691.  
  692. //-----------------------------------------------------------------------------------------------
  693.  
  694. #if GENERATING68K
  695.     #define PSIESHAPEPARTS_DISPATCH(selector) = CLIENT_DISPATCH(PSIEShapePartsSEG, selector);
  696. #else
  697.  
  698.     #define PSIESHAPEPARTS_DISPATCH(selector) ;
  699.     
  700.     #define _MakePatternDict                    MakePatternDict
  701.     #define _MakeDashDict                            MakeDashDict
  702.     #define    _GeometryDrone                        GeometryDrone
  703.     #define _GetPSLineCap                            GetPSLineCap
  704.     #define _PostScriptSynonymDrone        PostScriptSynonymDrone
  705.     #define    _FillShapeDrone                        FillShapeDrone
  706.     #define _StyleDrone                                StyleDrone
  707.     #define _DoTransformHiearchy            DoTransformHiearchy
  708.     #define _DoGrestore                                DoGrestore
  709.     #define _TransformDrone                        TransformDrone
  710.     #define _DoGsave                                    DoGsave
  711.     
  712. #endif
  713.  
  714. OSErr MakePatternDict(TIEGlobalsHdl hIEGlobals, gxPatternRecord* pPattern, gxStyleAttribute theAttributes)
  715.     PSIESHAPEPARTS_DISPATCH(1)
  716.  
  717. OSErr MakeDashDict(TIEGlobalsHdl hIEGlobals, gxDashRecord* pDash, gxStyleAttribute theAttributes)
  718.     PSIESHAPEPARTS_DISPATCH(2)
  719.  
  720. OSErr    GeometryDrone(TIEGlobalsHdl hIEGlobals, gxShape theShape, TgeometryOptions geomOptions, gxTransform *parents, long depth)
  721.     PSIESHAPEPARTS_DISPATCH(3)
  722.  
  723. OSErr GetPSLineCap(gxStyle theStyle, long *capVal)
  724.     PSIESHAPEPARTS_DISPATCH(4)
  725.  
  726. OSErr PostScriptSynonymDrone(TIEGlobalsHdl hIEGlobals, gxShape theShape, long nSyn)
  727.     PSIESHAPEPARTS_DISPATCH(5)
  728.  
  729. OSErr    FillShapeDrone(TIEGlobalsHdl hIEGlobals, gxShape theShape, gxTransform *parents, long depth)
  730.     PSIESHAPEPARTS_DISPATCH(6)
  731.  
  732. OSErr StyleDrone(TIEGlobalsHdl hIEGlobals, gxStyle theStyle)
  733.     PSIESHAPEPARTS_DISPATCH(7)
  734.  
  735. OSErr    DoTransformHiearchy(TIEGlobalsHdl hIEGlobals, gxTransform* parents, long depth, gxShape theShape)
  736.         PSIESHAPEPARTS_DISPATCH(8)
  737.                                             
  738. OSErr    DoGrestore(TIEGlobalsHdl hIEGlobals, Boolean internalOnly)
  739.     PSIESHAPEPARTS_DISPATCH(9)
  740.  
  741. OSErr TransformDrone(TIEGlobalsHdl hIEGlobals, gxTransform theTransform)
  742.       PSIESHAPEPARTS_DISPATCH(10)
  743.  
  744. OSErr DoGsave(TIEGlobalsHdl hIEGlobals, Boolean internalOnly) 
  745.       PSIESHAPEPARTS_DISPATCH(11)
  746.  
  747.  
  748. //-----------------------------------------------------------------------------------------------
  749.  
  750. #if GENERATING68K
  751.     #define PSIEINK_DISPATCH(selector) = CLIENT_DISPATCH(PSIEInkSEG, selector);
  752. #else
  753.  
  754.     #define PSIEINK_DISPATCH(selector) ;
  755.  
  756.     #define _InkDrone                                            InkDrone
  757.     #define _ColorSpacePrimitive                    ColorSpacePrimitive
  758.     #define _CalibratedRGBSpacePrimitive    CalibratedRGBSpacePrimitive
  759.     #define _GetLevel2ColorSpace                    GetLevel2ColorSpace
  760.     #define _RemoveDownloadedCRDs                    RemoveDownloadedCRDs
  761.     
  762. #endif
  763.  
  764.  
  765. OSErr InkDrone(TIEGlobalsHdl hIEGlobals, gxInk theInk)
  766.    PSIEINK_DISPATCH(1)
  767.  
  768. OSErr ColorSpacePrimitive(TIEGlobalsHdl hIEGlobals, gxColorSpace theSpace, gxColorProfile theProfile,
  769.                                                     Boolean setIt,Boolean *changed)
  770.       PSIEINK_DISPATCH(2)
  771.      
  772. OSErr CalibratedRGBSpacePrimitive(TIEGlobalsHdl hIEGlobals, gxColorProfile theProfile)
  773.       PSIEINK_DISPATCH(3)
  774.      
  775. OSErr    GetLevel2ColorSpace(gxColorSpace sourceSpace, gxColorProfile theProfile, gxColorSpace *level2Space, long *nComponents, Boolean *useDeviceSpace)
  776.          PSIEINK_DISPATCH(4)
  777.  
  778. OSErr RemoveDownloadedCRDs(TIEGlobalsHdl hIEGlobals)
  779.         PSIEINK_DISPATCH(5)
  780.  
  781.  
  782. //-----------------------------------------------------------------------------------------------
  783.  
  784.  
  785.  
  786.  
  787. #endif
  788.